package org.springframework.jdbc.core;

import top.malaoshi.jdbc.Record;
import top.malaoshi.sprout.jdbc.Transaction;

import javax.sql.DataSource;
import java.sql.SQLException;
import java.util.List;

public interface JdbcTemplate {

    public static final boolean AUTO_COMMIT = true;
//    public static final boolean AUTO_CLOSE = true;
    public void setAutoCommit(boolean b);
//    public void setAutoClose(boolean b);

    public void commmit() throws SQLException;
    public void rollback() throws SQLException;
    public void close() throws SQLException;
    public boolean isClosed() throws SQLException;

    public Transaction getTransaction();

    public List<Record> query(String sql, Object ... objects ) throws SQLException;

    public <E> List<E> query(Class clazz,String sql,Object ... params) throws SQLException;

    public List<Record> queryTag(String sql,  Object obj) throws SQLException;

    public <E> List<E> queryTag(Class clazz,String sql, Object obj) throws SQLException;

    public int update(String sql,Object ... objects) throws SQLException;

    public int updateTag(String sql , Object obj ) throws SQLException;

    public void setDataSource(DataSource dataSource);
}
